/*My Web Server 
 *Bhojan Anand
 */


import java.util.*;
import java.io.*;
import java.net.*;

import CommonClass.IMG;
import CommonClass.URLlink;
import CommonClass.keyword;
import dbAdapter.DatabaseAdapter;


public class Search_WebServer {
	
	static Search_engine search_engine;
	
	
    public static void main (String args[]) throws Exception 
	{
		// throws Exception here because don't want to deal
		// with errors in the rest of the code for simplicity.
		
		// Create a new TCP WELCOME SOCKET that waits for connection at port
		// number 9000.
//    	search_engine = new Search_engine();
//		ServerSocket serverSock = new ServerSocket(8000);
//		System.out.println("SERVER IS WAITING FOR HTTP REQUEST at PORT 7000...");
//		
//		while (true) 
//		{
//			//Listen & Accept Connection and Create new CONNECTION SOCKET
//			Socket s = serverSock.accept();
//				
//			//Construct an instance of HttpRequestProcessor to process this request
//			HttpRequestProcessor reqProcessor = new HttpRequestProcessor(s,search_engine);
//			
//			//Create a new thread to process the request
//			Thread thread = new Thread(reqProcessor);
//			
//			//Start the thread.
//			thread.start();		
//		
//		}
    	Vector<String> URL = new Vector<String>();
    	Vector<IMG> image = new Vector<IMG>();
    	Vector<keyword> _keyword = new Vector<keyword>();
    	DatabaseAdapter db = new DatabaseAdapter();
    	HashMap<URLlink,Integer> newList = new HashMap<URLlink,Integer>();
    	URLlink url1 = new URLlink("www.google.com");
    	URLlink url2 = new URLlink("www.yahoo.com");
    	URLlink url3 = new URLlink("www.google.com");
    	URL.add("www.google.com");
    	URL.add("www.yahoo.com");
    	URL.add("www.google.com");
    	image.add(new IMG("www.google.com/123",0,0));
    	image.add(new IMG("www.google.com/234",0,0));
    	image.add(new IMG("www.google.com/123",0,0));
    	_keyword.add(new keyword("lol","google"));
    	_keyword.add(new keyword("man","man"));
    	_keyword.add(new keyword("lol","googleimag"));
    	
  
    	
    	db.addResultList(URL,image,_keyword);
    	
	}
}
